<!-- 对工页面 -->
<template>
	<view class="page">
		<view class="content p-3">
			<view class="bt-block">
				<bg-cell2 valueColor='#4e5969' label="项目名称" :value="postData.projectName"></bg-cell2>
				<bg-cell2 valueColor='#4e5969' label="项目地址" :value="postData.projectAddr"></bg-cell2>
				<bg-cell2 valueColor='#4e5969' label="考勤日期" :value="postData.workDate"></bg-cell2>
				<bg-cell2 valueColor='#4e5969' :border="false" label="考勤员" :value="postData.recordUserName"></bg-cell2>
			</view>
		</view>
		<view class="bt-block mx-3">
			<view>
				<bg-cell2 label="工种" :value="postData.workJobTypeName"></bg-cell2>
			</view>
			<view class="px-3">
				<view class="py-4" :class="[idx<postData.userList.length-1?'border-bottom':'']" :key="idx" v-for="i,idx in postData.userList">
					<view class="font-14 mb-3">{{i.userName}}</view>
					<view class="flex justify-between">
						<view>
							<bg-desc label="日工" value="1小时"></bg-desc>
							<bg-desc label="加班" value="1小时"></bg-desc>
						</view>
						<view>
							<view class="small-btn">
								修改
							</view>
						</view>
					</view>
					
				</view>
			</view>
		</view>
		<view class="bt-footer">
			<bg-btn @click="saveData">确认全部对工(共{{postData.userList.length}}人)</bg-btn>
		</view>
	</view>
</template>

<script>
	import {getAttend, checkAttend} from "@/api/attend.js"
	
	export default {
		data() {
			return {
				serialNumber:'',
				postData:{}
			}
		},
		onLoad(options) {
			this.serialNumber = options.id
			this.getData()
		},
		methods: {
			getData(){
				getAttend(this.serialNumber).then(res=>{
					this.postData = res.data
				})
			},
			saveData(){
				checkAttend()
			}
		}
	}
</script>

<style scoped>
.page {
	padding-bottom: 180rpx;
}
</style>
